package jonathanfinerty.onceexample;

import jonathanfinerty.once.Once;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Assert;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class ExampleOhosTest {
    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("jonathanfinerty.onceexample", actualBundleName);
    }

    @Test
    public void testSession() {
        String sign = "NewSessionDialog";
        Once.markDone(sign);
        Assert.assertTrue(Once.beenDone(Once.THIS_APP_SESSION, sign));
    }

    @Test
    public void testInstall() {
        String sign = "FreshInstallDialog";
        Once.markDone(sign);
        Assert.assertTrue(Once.beenDone(Once.THIS_APP_SESSION, sign));
    }

    @Test
    public void testPerVersion() {
        String sign = "NewVersionDialog";
        Once.markDone(sign);
        Assert.assertTrue(Once.beenDone(Once.THIS_APP_SESSION, sign));
    }

    @Test
    public void testPerMinute() {
        String sign = "OncePerMinuteDialog";
        Once.markDone(sign);
        Assert.assertTrue(Once.beenDone(Once.THIS_APP_SESSION, sign));
    }

    @Test
    public void testPerSecond() {
        String sign = "OncePerSecondDialog";
        Once.markDone(sign);
        Assert.assertTrue(Once.beenDone(Once.THIS_APP_SESSION, sign));
    }
}